<template>
  <el-pagination
    :current-page="page"
    :page-sizes="[2, 3, 5, 10]"
    :page-size="pagesize"
    layout="total, sizes, prev, pager, next, jumper"
    :total="total"
    @size-change="handleSizeChange"
    @current-change="handleCurrentChange"
  />
</template>
<script>
export default {
  props: {
    page: {
      type: Number,
      required: true
    },
    pagesize: {
      type: Number,
      required: true
    },
    total: {
      type: Number,
      required: true
    }
  },
  methods: {
    // 分页
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
      // this.p.size = val
      // this.p.page = 1
      this.$emit('SizeChange', val)
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
      // this.p.page = val
      this.$emit('CurrentChange', val)
    }
  }
}
</script>
